﻿using GraphProcessor;
using IQIGame.Onigao.Logic;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay.Editors
{
    [System.Serializable, NodeMenuItem(SkillEditorConst.SkillEffective + "/" + SkillEditorConst.CustomPropertyInt, typeof(SkillEditorGraph))]
    public class SkillEffectiveNode_CustomProperty : SkillEffectiveNode
    {
        protected override ESkillEffectiveType effectType => ESkillEffectiveType.CustomPropertyInt;

        [InspectorName("自定义属性类型")] public ECustomProperty property = ECustomProperty.CustomTempInt;
        [SkillEditorNode("自定义Key", "CustomKey")]
        public string customKey = string.Empty;
        [InspectorName("修改方式")] public SkillEffective_CustomPropertyInt.ECustomPropertyChangeType type;
        [Output("修改值")] public FormulaSetter value;

        protected override SkillCustomConfig CreateConfig()
        {
            var rConfig = new SkillEffective_CustomProperty_ConfigData()
            {
                propertyKey = (int)this.property,
                customKey = this.customKey,
                type = (int)this.type,
            };
            this.value = new FormulaSetter((x) => rConfig.value = x);
            return rConfig;
        }
    }
}